package ai.people.netmon.framework.domain.system.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.people.core.validator.annotation.NumberStatusValue;
import com.people.core.validator.group.AddGroup;
import com.people.core.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.time.LocalDateTime;

/**
 * 系统用户
 *
 * @author yuanqinglong
 * @date 2022/3/22 10:52
 */
@Data
@TableName(value = "nm_sys_user")
public class NmSystemUser {

    /**
     * id
     */
    @TableId
    @JSONField(serializeUsing = ToStringSerializer.class)
    @NotNull(message = "id不可为空", groups = UpdateGroup.class)
    @Null(message = "id非法", groups = {AddGroup.class})
    private Long id;

    /**
     * 账户
     *
     * @mock zhangSan
     */
    @NotEmpty(message = "账号为空")
    private String account;

    /**
     * 电话
     * @mock 15100000000
     */
    private String phone;

    /**
     * 密码
     * @mock 222888
     */
    @NotEmpty(message = "密码为空")
    private String password;

    /**
     * 登录错误计数
     * @ignore
     */
    private Integer loginErrorCount;

    /**
     * 状态 1:正常，2:被锁定，3:被举报
     */
    @NumberStatusValue(values = {1, 2, 3}, message = "状态参数值错误")
    private Integer status;

    /**
     * 修改时间
     * @ignore
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime modifyTime;

    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;


    /**
     * 更新时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

}
